-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Persist IP addresses related to VM access via CPVM #9534
base: main
Are you sure you want to change the base?
Persist IP addresses related to VM access via CPVM #9534
Conversation
@blueorangutan package |
@bernardodemarco a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress. |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #9534 +/- ##
============================================
- Coverage 15.77% 15.77% -0.01%
Complexity 12538 12538
============================================
Files 5621 5621
Lines 491556 491578 +22
Branches 60227 62625 +2398
============================================
- Hits 77562 77561 -1
- Misses 405537 405559 +22
- Partials 8457 8458 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ debian ✔️ suse15. SL-JID 10674 |
This pull request has merge conflicts. Dear author, please fix the conflicts and sync your branch with the base branch. |
4d62ae2
to
cdec550
Compare
@bernardodemarco , I understand what and how, but have a hard time to get the why of this PR. Can you expand on that please? |
The main idea behind the proposed enhancement is to help operators better identify who accessed a virtual machine console. The |
thanks, makes sense. |
@nvazquez can you have a look at this one? |
This pull request has merge conflicts. Dear author, please fix the conflicts and sync your branch with the base branch. |
cdec550
to
e49980f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clgtm
@blueorangutan package |
@DaanHoogland a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress. |
Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ debian ✔️ suse15. SL-JID 11055 |
This pull request has merge conflicts. Dear author, please fix the conflicts and sync your branch with the base branch. |
e49980f
to
1ed976f
Compare
@blueorangutan package |
@DaanHoogland a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress. |
|
Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ debian ✔️ suse15. SL-JID 11071 |
@blueorangutan test keepEnv |
@DaanHoogland a [SL] Trillian-Jenkins test job (ol8 mgmt + kvm-ol8) has been kicked to run smoke tests |
I tested the PR again, following the steps provided on the description, and the IP addresses were stored correctly. It's important to remember that if there were any running CPVMs prior to the environment update, then they would need to be recreated in order to test if the Furthermore, it's interesting taking a look at the CPVM logs. The following logs were generated during my tests, which indicates that the client IP 2024-09-10T17:19:38,330 INFO [cloud.consoleproxy.ConsoleProxyNoVNCHandler] (qtp2090537387-40:[]) Verifying session
source IP 192.168.122.1 from WebSocket connection request.
2024-09-10T17:19:38,331 DEBUG [cloud.consoleproxy.ConsoleProxyNoVNCHandler] (qtp2090537387-40:[]) Session source IP
192.168.122.1 has been verified successfully. @weizhouapache, if the problem continues happening, could you please describe your tests steps and share the CPVM logs? |
Thanks @bernardodemarco |
[SF] Trillian test result (tid-11441)
|
@JoaoJandre , it looks like this is ready. should we merge it before 4.20? |
I think we should leave this for 4.21. We're only accepting bugfixes currently. |
Description
This PR proposes to persist IP addresses related to VM access via CPVM. Specifically, it stores the IP address of the client accessing a VM and the IP address of the console endpoint creator. To achieve this, the
cloud.console_session
table was extended with two new columns:client_address
, which stores the client's IP address, andconsole_endpoint_creator_address
, which captures the IP address of the console endpoint creator.These IP addresses were already being captured for logging and validation purposes. The console endpoint creator's IP is captured here, at the start of the
CreateConsoleEndpointCmd
execution:cloudstack/api/src/main/java/org/apache/cloudstack/api/command/user/consoleproxy/CreateConsoleEndpointCmd.java
Lines 65 to 68 in 47a6b70
The client address is captured by calling
session.getRemoteAddress().getAddress().getHostAddress()
in this method, that gets executed when the client connects to the console:cloudstack/services/console-proxy/server/src/main/java/com/cloud/consoleproxy/ConsoleProxyNoVNCHandler.java
Lines 157 to 160 in 47a6b70
Types of changes
Feature/Enhancement Scale or Bug Severity
Feature/Enhancement Scale
Screenshots (if appropriate):
How Has This Been Tested?
client_address
andconsole_endpoint_creator_address
columns to thecloud.console_session
table.SELECT * FROM `cloud`.`console_session` ORDER BY created DESC LIMIT 1;
As can be noticed, the
console_endpoint_creator_address
column was populated accordingly, whereas theclient_adress
was still empty since the VM had not been accessed yet.SELECT * FROM `cloud`.`console_session` ORDER BY created DESC LIMIT 1;
As can be noticed, the IP address of the client that accessed the VM through CPVM was persisted correctly.